<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
	<meta charset="utf-8" />
	<meta name="keywords" content="pinpin社保" />
	<meta name="description" content="pinpin社保" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="renderer" content="webkit" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>社保运营后台-购买控制列表</title>
	<%@ include file="/WEB-INF/jsp/common/common.jsp" %>
</head>
<body>
	<div id="wrapper">
        <%@ include file="/WEB-INF/jsp/common/menu.jsp" %>
        <div id="page-wrapper">
        	<div class="row">
                <div class="col-lg-12">
                    <!-- 路径导航 -->
                    <ol class="breadcrumb">
				      <li>社保后台</li>
				      <li class="active">购买控制列表</li>
				    </ol>
                </div>
            </div>
            <div class="row">
            	<div class="col-lg-12">
            		<div class="panel panel-default">
            			<div class="panel-body">
        			    	<div class="form-inline dt-bootstrap no-footer">
        			    		<!-- 表单查询 -->
        			    		<form action="" method="POST" class="form-check" id="queryForm">
        			    		<div class="row">
        			    			<div class="col-lg-12">
        			    				<input type="text" class="form-control" name="id_card" placeholder="身份证号" value="${id_card }"/>
        			    			    <button type="submit" class="btn btn-primary">查 询</button>
        			    			    <button type="button" id="resetBtn" class="btn btn-primary">重置</button>
        			    			</div>
        			    		</div>
        			    		</form>
        			    		<!-- 分页 -->
        			    		<div class="row">
        			    			<div class="col-lg-2">
        			    			</div>
        			    			<div class="col-lg-10">
        			    				<jsp:include page="/WEB-INF/jsp/common/page.jsp">
        			    					<jsp:param name="formId" value="queryForm"/>
        			    				</jsp:include>
        			    			</div>
        			    		</div>
        			    		<!-- 表格列表 -->
        			    		<div class="row">
        			    			<div class="col-lg-12">
        			    				<table id="dataContent" class="table table-striped table-bordered table-hover no-footer" role="grid">
        			    					<thead>
        			    						<tr>
                                                    <th>城市 档位</th>
                                                    <th>姓名</th>
                                                    <th>户籍</th>
                                                    <th>公积金</th>
                                                    <th>操作</th>
                                                </tr>
        			    					</thead>
        			    					<tbody>
        			    					<c:forEach items="${pageModel.recordList }" var="l">
	        			    					<tr role="row">
                                                    <td>
                                                    	${l.city_name }
                                                    	${l.cid_name }
                                                    </td>
                                                    <td>${l.user_name }</td>
                                                    <td>
                                                    	<c:if test="${l.hukou == 1}">本市城镇</c:if> 
                                                    	<c:if test="${l.hukou == 2}">本市农村</c:if>
                                                    	<c:if test="${l.hukou == 3}">外地城镇</c:if>
                                                    	<c:if test="${l.hukou == 4}">外地农村</c:if>
                                                    </td>
                                                    <td>${l.fund_price }</td>
                                                    <td>
                                                    	<a href="javascript:showEditBox(${l.id}, ${l.cid},${l.fund_price });" id="aedit${l.id}">修改</a>
                                                    </td>
        			    					</c:forEach>

        			    					</tbody>
        			    				</table>
        			    				
        			    			</div>
        			    		</div>
        			    		<!-- 分页 -->
        			    		<div class="row">
        			    			<div class="col-lg-2">
        			    			</div>
        			    			<div class="col-lg-10">
        			    				<jsp:include page="/WEB-INF/jsp/common/page.jsp">
        			    					<jsp:param name="formId" value="queryForm"/>
        			    				</jsp:include>
        			    			</div>
        			    		</div>
        			    		
        			    	</div>
            			</div>
            		</div>
            	</div>
            </div>
        </div>
	</div>
	
	<div id="editBox" style="display:none;width:180px">
		<form action="" id="edit_form">
			<input type="hidden" class="form-control" id="id" name="id"/>
			档位标识：<input type="text" class="form-control" style="width:120px" id="cid" name="cid"/>
			公积金额：<input type="text" class="form-control" style="width:120px" id="fund_price" name="fund_price"/>
			<button type="button" class="btn btn-primary btn-sm" onclick="javascript:saveEdit()">保存修改</button>
		</form>
	</div>
</body>
    <script language="javascript">
    $(function() {
    	$("#resetBtn").click(function(){
    		$("#queryOrderForm").find("input[type=text],select").filter(function(index) {
				  return $(this).attr("dataType") != "city_select";
			}).val("");
    	});
    });
    

    function showEditBox(id, cid, fund_price) {
  	   $("#id").val(id);
 	   $("#cid").val(cid);
 	   $("#fund_price").val(fund_price);

       var content=document.getElementById("editBox");
       dialog({
     	  title: '修改',
     	  content: content,
     	  follow: document.getElementById("aedit"+id),
     	  quickClose:true}).show();
    }
    

    function saveEdit() {
 	   var data = $("#edit_form").serialize();
 	   jQuery.ajax({
 		   url: "${buyed_edit_uri}",
 		   data: data,
 		   type:'post', 
 		   async : true, //默认为true 异步
 		   error: function(jqXHR, textStatus, errorThrown) {
 			   
 		   },
 		   success:function(result){
 			   smokeAlert(result.code, result.msg);
 			   if (result.code == 200) {
 				   window.location.reload();
 			   }
 		   }
 	   });
    }
    
    </script>
</html>